import React, { Component } from 'react'
import Son from './Grandson'
import { Provider } from './context'

export default class Parent extends Component {
  state = {
    money: 20000000
  }
  changeVal = money => {
    this.setState({
      money
    })
  }
  render () {
    return (
      <div>
        Parent
        <hr />
        <Provider value={{ money: this.state.money, callback: this.changeVal }}>
          <Son />
        </Provider>
      </div>
    )
  }
}
